﻿import React, { Component } from 'react'
import PropTypes from 'prop-types'
import './common.css'
import './Expandable.css'

export default class Expandable extends Component {
    static propTypes = {
        text: PropTypes.string.isRequired,
        expanded: PropTypes.bool,
        onExpand: PropTypes.func.isRequired
    }
    render() {
        return <div className='hflex'>
            <div className='expand-box' onClick={this.props.onExpand}>
                {this.props.expanded ? '-' : '+'}
            </div>
            <span>{this.props.text}</span>
        </div>
    }
}